const fs = require("fs");
const uuid = require("node-uuid");
const moment = require("moment");
const path = require("path");
const level = {
    "warn": 1,
    "update": 2,
};
const noticeList = JSON.parse(fs.readFileSync("./notice.json").toString());
const basePath = "./notice";
for (const key in level) {
    const dirPath = path.resolve(basePath, key);
    const fielList = fs.readdirSync(dirPath);
    for (const file of fielList) {
        noticeList.push({
            title: path.basename(file, ".md"),
            content: fs.readFileSync(path.join(dirPath, file)).toString(),
            createTime: moment(new Date()).format("YYYY-MM-DD HH:mm:ss"),
            level: level[key],
            id: uuid.v1(),
        });
    }

}
fs.writeFileSync("./notice.json", JSON.stringify(noticeList, undefined, 4));
